class GameSceneReplayMenu extends BasePanel {

    btn_pause: ButtonEx;
    btn_play: ButtonEx;
    btn_prev: ButtonEx;
    btn_next: ButtonEx;

    face: IGameTapEvent;

    constructor() {
        super();
        this.skinName = 'GameSceneReplayMenuSkin';
    }

    childrenCreated() {
        super.childrenCreated();

        this.horizontalCenter = this.verticalCenter = 0;
    }

    bindInterface(face: IGameTapEvent) {
        this.face = face;

        this.btn_pause.addEventListener(egret.TouchEvent.TOUCH_TAP, this.face.onReplayPauseTap, this.face);
        this.btn_play.addEventListener(egret.TouchEvent.TOUCH_TAP, this.face.onReplayPlayTap, this.face);
        this.btn_prev.addEventListener(egret.TouchEvent.TOUCH_TAP, this.face.onReplayFBTap, this.face);
        this.btn_next.addEventListener(egret.TouchEvent.TOUCH_TAP, this.face.onReplayFFTap, this.face);
    }

    play() {
        this.btn_play.visible = false;
        this.btn_pause.visible = true;
    }

    pause() {
        this.btn_play.visible = true;
        this.btn_pause.visible = false;
    }

    static play() {
        if (LayerManager.i.panelLayer.numChildren) {
            const menu: GameSceneReplayMenu = gameManager.find("GameSceneReplayMenu");
            if (menu) {
                menu.play();
            }
        }
    }

    static pause() {
        if (LayerManager.i.panelLayer.numChildren) {
            const menu: GameSceneReplayMenu = gameManager.find("GameSceneReplayMenu");
            if (menu) {
                menu.pause();
            }
        }
    }

    show(eff: number, dark: boolean) {
        super.show(eff, dark);
        this.play();
    }
}